#ifndef _IMG_PROCESS
#define _IMG_PROCESS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef unsigned char BYTE;
typedef unsigned char* P_BYTE;

typedef struct _image_par {
    int Width;
    int Height;
    int Size;
} ImageInfo;

typedef struct _image {
    ImageInfo Info;
    P_BYTE ImgBuf;
} Image, *PImage;

typedef struct _sub_image {
    ImageInfo Info;
    int NumImg;
    P_BYTE* ptrImgBuf;
} SubImage, *PSubImage;

typedef struct _pic_par {
    ImageInfo Y;
    ImageInfo U;
    ImageInfo V;
} PictureInfo;

typedef struct _picture {
    Image Y;
    Image U;
    Image V;
} Picture, *PPicture;

typedef struct _sub_picture {
    SubImage Y;
    SubImage U;
    SubImage V;
} SubPicture, *PSubPicture;

//Image
int InitImage (ImageInfo strImg, ImageInfo strSubImg, PImage ptrImg, PSubImage ptrSubImg);
int DeleteImage (PImage ptrImg, PSubImage ptrSubImg);
int ImageSplit (PImage ptrImg, PSubImage ptrSubImg);
int ImageAssemble (PSubImage ptrSubImg, PImage ptrImg);

//Picture
int InitPicture (PictureInfo strPic, PictureInfo strSubPic, PPicture ptrPic, PSubPicture ptrSubPic);
int DeletePicture (PPicture ptrPic, PSubPicture ptrSubPic);
int PictureSplit (PPicture ptrPic, PSubPicture ptrSubPic);
int PictureAssemble (PSubPicture ptrSubPic, PPicture ptrPic);

//for test
int Split (int argc, char** argv);
int Assemble (int argc, char** argv);
#endif